package com.ctshk.rpc.order.tour.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ctshk.rpc.order.tour.code.IsDeletedCode;
import com.ctshk.rpc.order.tour.req.SeriesOrderDiscountListReq;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 系列团游客收款 Provider 接口
 * </p>
 *
 * @author 谭响
 * @since 2021-01-18
 */
public class SeriesOrderDiscountProvider {

    public String selectListBySelective(IPage<SeriesOrderDiscountListReq> pageParam, @Param("req") SeriesOrderDiscountListReq req) {
        StringBuilder sb = new StringBuilder();
        sb.append("select tsod.id, tsod.order_id, tsod.tourist_id, " +
                "tsoti.cn_surname, tsoti.cn_name, " +
                "tsod.check_status, " +
                "tsod.before_amount, tsod.discount_amount, " +
                "tsod.remark, tsod.create_id, tsod.gmt_create, tsod.discount_type_id, tsod.discount_type " +
                "from t_series_order_discount tsod ");
        sb.append("left join t_series_order_tourist_info tsoti ON tsod.tourist_id = tsoti.id ");
        sb.append("where 1=1 ");
        sb.append("and tsod.is_deleted = " + IsDeletedCode.NO.getCode() + " ");
        sb.append("and tsod.order_id = #{req.orderId} ");
        return sb.toString();
    }
}
